function timerJetX(time) { $('.jetx-promotion .timer').removeClass('end'); let countDownDate = new Date(time).getTime(); //let x = setInterval(function() { // Get today's date and time let now = new Date().getTime(); // Find the distance between now and the count down date let distance = countDownDate - now; if (distance < 1000 * 60 * 60) $('.jetx-promotion .timer').addClass('end'); // Time calculations for days, hours, minutes and seconds let days = Math.floor(distance / (1000 * 60 * 60 * 24)); let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((distance % (1000 * 60)) / 1000); $('.jetx-promotion .days').html(timerItem(days)); $('.jetx-promotion .hours').html(timerItem(hours)); $('.jetx-promotion .minutes').html(timerItem(minutes)); // If the count down is finished, write some text //if (distance < 0) { // clearInterval(x); //} //}, 10000000); } function DrawJetXPromotionPopup(data) { let enableDays = data.EnableDays; for (let i = 0; i < enableDays.length; i++) { if (enableDays[i]) { let $progress = document.querySelectorAll('.promotion-progress')[i]; $($progress).attr('class', 'promotion-progress active'); let $tabs = document.querySelectorAll('.promotion-tab')[i]; $($tabs).attr('class', `promotion-tab tab-day${i + 1} ${i === 0 ? 'active' : ''}`); } else { let $progress = document.querySelectorAll('.promotion-progress')[i]; $($progress).attr('class', 'promotion-progress disabled'); let $tabs = document.querySelectorAll('.promotion-tab')[i]; $($tabs).attr('class', `promotion-tab tab-day${i + 1} disabled`); } } for (let i = 1; i < 4; i++) { $(`.tab-day${i}`).attr('data-dayleftcount', data[`Day${i}SuccessCount`]); } if (!enableDays[1] && data['CashbackDay1'].length > 0) { let $element = $('.promotion-progress')[0]; $($element).removeClass('disabled').addClass('active'); } UpdateJetXPromotionFooterText(1); for (let i = 1; i < enableDays.length + 1; i++) { if (data['CashbackDay' + i] === undefined || data['CashbackDay' + i] === null) return; let html = ReturnJetxPromoutionList(data['CashbackDay' + i], data[`Day${i}SuccessCount`], i); $('.CashbackDay' + i).html(html); } $('.promotion-bet-sum').html(parseFloat(data.BetSum).toFixed(fractionDigit) + ' ' + currencyCode); $('.jetx-promotion').fadeIn(100).addClass(localeCode); $('.rulesText1').html(GetCaption('jetx.promotion.rules.restrictions.budget.one').format(data.GiftType.Bet, currencyCode)); $('.rulesText2').html(GetCaption('jetx.promotion.rules.restrictions.budget.two').format(data.GiftType.Bet * 100000, currencyCode)); } function ReturnJetxPromoutionList(lists, succesCount, index) { const maxListCount = succesCount > 10 ? succesCount : 10; let percent = (100 * succesCount) / maxListCount; progressBar(percent, index); let html = '' for (let i = 0; i < lists.length; i++) { if (lists[i] !== undefined) { html += `